package com.itheima.api.treemap.demo02;

import java.util.Set;
import java.util.TreeMap;

public class TreeMapDemo01 {

    public static void main(String[] args) {

        Student s1 = new Student("张三", 18);
        Student s2 = new Student("李四", 23);
        Student s3 = new Student("王五", 20);

        TreeMap<Student, String> treeMap = new TreeMap<Student, String>();

        treeMap.put(s1, "北京");
        treeMap.put(s2, "上海");
        treeMap.put(s3, "深圳");

        treeMap.forEach((o1, o2) -> System.out.println(o1.getName() + "----" + o1.getAge() + "----" + o2));

    }

}
